package com.itheima.health.jobs;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itheima.health.service.OrderSettingService;
import lombok.extern.slf4j.Slf4j;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author ： chen
 * @date ：Created in 2020/1/2 11:37
 * @description ：
 * @version: 1.0
 */
@Slf4j
public class CleanHistoricalData {

    @Reference
    private OrderSettingService orderSettingService;

    public void cleandata(){
        //获取今日日期信息 删除数据库日期之前信息
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        String time = df.format(new Date());
        orderSettingService.cleanData(time);
        log.info("历史预约信息清理完成");
    }
}
